Conversation
| <h1>Statistieken</h1> | ||
| <ul> | ||
| <li>Totaal aantal producten: {{ total_products }}</li> | ||
| <li>Totaal aantal aanbiedingen van producten: {{ total_offers }}.</li> |
There was a problem hiding this comment.
Ik denk dat voor veel gebruikers niet heel duidelijk zal zijn wat hier precies staat. Het is denk ik niet heel duidelijk wat het verschil tussen de 1e en de 2e is. Het woord "aanbiedingen" heeft ook een dubbele betekenis.
|
|
||
| products: List[Product] = Product.query.all() | ||
|
|
||
| total_product: int = len(products) |
There was a problem hiding this comment.
Lijkt me een beetje zonde om alle producten in te laden alleen om te kijken hoe lang de lijst is.
Kunnen we niet dit gebruiken: https://docs.sqlalchemy.org/en/20/orm/queryguide/query.html#sqlalchemy.orm.Query.count
There was a problem hiding this comment.
Hmm dat klinkt wel beter, maar misschien ook eens uitzoeken wat de SQLAlchemy v2.0 manier is om dat te doen
There was a problem hiding this comment.
There was a problem hiding this comment.
dat lijkt me de nieuwe versie inderdaad
First work for #30